//
//  HQAppTableViewCell.m
//  试一下demo
//
//  Created by quan on 15/11/18.
//  Copyright © 2015年 quan. All rights reserved.
//

#import "HQAppTableViewCell.h"
#import "HQApp.h"

@interface HQAppTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@property (weak, nonatomic) IBOutlet UILabel *introLabel;


@end

@implementation HQAppTableViewCell

//返回一个可以重用的cell
+ (instancetype)appCell:(UITableView *)tableView{
    static NSString *appIdentifier = @"appIdentifier";
    HQAppTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:appIdentifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"HQAppTableViewCell" owner:nil options:nil] lastObject];
    }
    return cell;
}

//赋值
- (void)setApp:(HQApp *)app{
    _app = app;
    
    self.iconView.image = [UIImage imageNamed:app.appIcon];
    
    self.nameLabel.text = app.appName;
    self.introLabel.text = app.intro;
    self.introLabel.numberOfLines = 0;
}

//做个圆角
- (void)awakeFromNib {
    // Initialization code
    self.iconView.layer.cornerRadius = 5;
    self.iconView.clipsToBounds = YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
